from rest_framework import serializers
from rest_framework.serializers import ModelSerializer

from apps.goods.models import GoodsVisitCount


# 定义访问数量序列化器
class UserModelSerializer(ModelSerializer):
    # 嵌套序列化返回字段指定
    category = serializers.StringRelatedField(read_only=True)

    class Meta:
        model = GoodsVisitCount
        fields = ('category', 'count', 'date')
